import request from '@/config/axios'
import { url } from 'inspector'

export interface PatientVO {
  id: number
  username: string
  nickname: string
  deptId: number
  postIds: string[]
  email: string
  mobile: string
  sex: number
  avatar: string
  loginIp: string
  status: number
  remark: string
  loginDate: Date
  createTime: Date
}

// 查询患者
export const getPatient = async (id: number) => {
  return await request.get({ url: '/medical/patient/get?id=' + id })
}

// 查询列表
export const getPatientPage = async (params: PageParam) => {
  return await request.get({ url: '/medical/patient/page', params })
}


// 新增患者
export const createPatient = async (data: PatientVO) => {
  return await request.post({ url: '/medical/patient/create', data: data })
}

// 新增患者
export const createChildrenPatient = async (data: PatientVO) => {
  return await request.post({ url: '/medical/patient/create-children', data: data })
}

// 修改患者
export const updatePatient = async (params: PatientVO) => {
  return await request.put({ url: '/medical/patient/update', data: params })
}

// 删除
export const deletePatient = async (id: number) => {
  return await request.delete({ url: '/medical/patient/delete?id=' + id })
}

// 获取全部分类为主用户的用户
export const getAllParentUserList = async () => {
  return await request.get({ url: '/medical/patient/list-all-parent' })
}

// 获取病人列表
export const getPatientList = async () => {
  return await request.get({ url: '/medical/patient/list'})
}
